<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=GB18030">
<title>书香阁 - 登录</title>
<style>
  body {
    font-family: 'Arial', sans-serif;
    margin: 0;
    padding: 0;
    display: flex;
    justify-content: center;
    align-items: center;
    height: 100vh;
    background: linear-gradient(rgba(0, 0, 0, 0.5), rgba(0, 0, 0, 0.5)), 
                url('https://images.unsplash.com/photo-1507842217343-583bb7270b66?ixlib=rb-1.2.1&auto=format&fit=crop&w=1350&q=80') no-repeat center center fixed;
    background-size: cover;
    color: #333;
  }
  
  .login-container {
    width: 400px;
    padding: 40px;
    border-radius: 10px;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    background-color: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(5px);
    animation: fadeIn 0.5s ease-in-out;
  }
  
  @keyframes fadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
  }
  
  .login-container h2 {
    text-align: center;
    margin-bottom: 30px;
    color: #5a3921;
    font-weight: 300;
    font-size: 28px;
  }
  
  .login-container form p {
    margin-bottom: 20px;
  }
  
  .login-container input[type="text"],
  .login-container input[type="password"],
  .login-container select {
    width: 100%;
    padding: 12px 15px;
    margin-top: 8px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 16px;
    transition: all 0.3s;
    box-sizing: border-box;
  }
  
  .login-container input[type="text"]:focus,
  .login-container input[type="password"]:focus,
  .login-container select:focus {
    border-color: #8d6e63;
    box-shadow: 0 0 0 3px rgba(141, 110, 99, 0.2);
    outline: none;
  }
  
  .login-container input[type="submit"],
  .login-container input[type="button"] {
    padding: 12px 25px;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 16px;
    transition: all 0.3s;
    margin-right: 10px;
  }
  
  .login-container input[type="submit"] {
    background-color: #8d6e63;
    color: white;
  }
  
  .login-container input[type="button"] {
    background-color: #a5a5a5;
    color: white;
  }
  
  .login-container input[type="submit"]:hover {
    background-color: #6d4c41;
    transform: translateY(-2px);
  }
  
  .login-container input[type="button"]:hover {
    background-color: #8a8a8a;
    transform: translateY(-2px);
  }
  
  .button-group {
    display: flex;
    justify-content: center;
    margin-top: 30px;
  }
  
  .error-message {
    color: #d32f2f;
    text-align: center;
    margin-top: 15px;
    font-size: 14px;
    padding: 10px;
    background-color: #ffebee;
    border-radius: 4px;
    border-left: 4px solid #d32f2f;
  }
  
  .book-icon {
    text-align: center;
    font-size: 40px;
    margin-bottom: 20px;
    color: #8d6e63;
  }
</style>
<script>
  function cancelLogin() {
    if(confirm("真的不进来看看吗？我们有很多好书等着您呢！")) {
      // 用户点击确认，留在当前页面
      return false;
    } else {
      // 用户点击取消，也留在当前页面
      return false;
    }
  }
</script>
</head>
<body>
<div class="login-container">
  <div class="book-icon">📚</div>
  <h2>欢迎来到书香阁</h2>
  <form action="loginAction.jsp" method="post">
    <p>
      <label for="username">用户名：</label>
      <input type="text" id="username" name="username" placeholder="请输入您的用户名" required />
    </p>
    <p>
      <label for="pwd">密&nbsp;&nbsp;码：</label>
      <input type="password" id="pwd" name="pwd" placeholder="请输入您的密码" required />
    </p>
    <p>
      <label for="usertype">用户类型：</label>
      <select id="usertype" name="usertype">
        <option value="1">管理员</option>
        <option value="2" selected>普通用户</option>
        <option value="3">商家</option>
      </select>
    </p>
    <div class="button-group">
      <input type="submit" value="登录" />
      <input type="button" value="取消" onclick="cancelLogin()" />
    </div>
  </form>
  <% if ("true".equals(request.getParameter("error"))) { %>
    <div class="error-message">
      用户名或密码错误，请重新输入。
    </div>
  <% } %>
</div>
</body>
</html>